package com.zenika.zenbinding.client.renderer;

import com.google.gwt.user.client.ui.Widget;
import com.zenika.zenbinding.client.feedback.DummyFeedbackManager;
import com.zenika.zenbinding.client.model.BusinessObject;

/**
 * A Renderer is an object which creates a display adapted to an object. For
 * example : We can have a renderer which shows a red circle if we call
 * render(false) and a green one for render(true). Renderers are mainly used in
 * databinding with Tables.
 * @author Zenika
 */
public interface Renderer {

	/**
	 * Set the style name of the returned Widget.
	 * @param style style name
	 */
	public void setStyleName(String style);

	/**
	 * Return the widget generated in function of the business object.
	 * @param source
	 * @return generated widget
	 */
	public Widget render(BusinessObject source);

	/**
	 * Return the widget generated in function of the business object and insert
	 * a dummy FeedbackManager.
	 * @param source
	 * @param manager
	 * @return generated widget
	 */
	public Widget render(BusinessObject source, DummyFeedbackManager manager);

}
